package com.company;

import java.io.File;

public class ChangeFileName {

    public static void main(String[] args) {
        String filePath = "C:\\Users\\Administartro\\Desktop\\比赛-线下\\饮料换购\\测评用例\\";
        File file = new File(filePath);
        for (File fileItem : file.listFiles()) {
            String name = fileItem.getName();
            if (name.startsWith("in")){
                fileItem.renameTo(new File(filePath + name.substring(2, 3) + ".in"));
                System.out.println(name.substring(2, 3) + ".in");
            } else if (name.startsWith("out")){
                fileItem.renameTo(new File(filePath + name.substring(3, 4) + ".out"));
                System.out.println(name.substring(3, 4) + ".out");
            }
        }
    }

}
